define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
        $scope.form = {};
        $scope.menu_name = "更换单位审核";

        //查询单位更换申请
        $scope.find = function() {
            let pVo = {"fk_user": params.id};
            if ($scope.form.changestate != null && $scope.form.changestate != ""){
                pVo.changestate = $scope.form.changestate;
            }
            if ($scope.form.teachername != null && $scope.form.teachername != ""){
                pVo.teachername = $scope.form.teachername;
            }
            if ($scope.form.sfzjh != null && $scope.form.sfzjh != ""){
                pVo.sfzjh = $scope.form.sfzjh;
            }

            httpService.postpage(app.urls.findUnitChangeURL, pVo,function(data){
                if("0000" === data.code){
                    $scope.rows = data.data;
                }else{
                    alert(data.msg);
                }
            });
        }
        $scope.find();

        //按钮点击事件-条件查询
        $scope.select = function(){
            $scope.page.current = 1;
            $scope.find();
        }

        //批量通过
        $scope.auditPass = function() {
            var values = [];
            $('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){
                values.push($(this).val());
            });
            if(values.length < 1){
                eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择数据。"});
            }else{
                eventBusService.publish("modal.alert",{"content":"你是否确认通过这"+values.length+"个人提交的申请？","isAutoClose":false,"confirm":function(){
                    httpService.post(app.urls.auditPassUnitChangeURL, {"values":JSON.stringify(values)}, function(data) {
                        if ("0000" === data.code) {
                            $scope.find();
                        } else {
                            alert(data.msg);
                        }
                    });
                },"cancel":function(){
                        //用户取消，不做操作
                }});
            }
        }

        //批量不通过
        $scope.auditFail = function() {
            var values = [];
            var ids="";
            $('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){
                values.push($(this).val());
                ids = ids+",'"+$(this).val()+"'";
            });
            if(values.length < 1){
                eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择数据。"});
            }else{
                eventBusService.publish("modal.alert",{"content":"你是否确认不通过这"+values.length+"个人提交的申请？","isAutoClose":false,"confirm":function(){
                        httpService.post(app.urls.auditFailUnitChangeURL,{"values":JSON.stringify(values)}, function(data) {
                            if ("0000" === data.code) {
                                $scope.find();
                            } else {
                                alert(data.msg);
                            }
                        });
                    },"cancel":function(){
                        //用户取消，不做操作
                    }});
            }
        }

        //批量删除
        $scope.del = function() {
            var values = [];
            var ids="";
            $('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){
                values.push($(this).val());
                ids = ids+",'"+$(this).val()+"'";
            });
            if(values.length < 1){
                eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择数据。"});
            }else{
                eventBusService.publish("modal.alert",{"content":"你是否确认删除这"+values.length+"个人提交的申请？","isAutoClose":false,"confirm":function(){
                        httpService.post(app.urls.deleteUnitChangeURL,{"values":JSON.stringify(values)}, function(data) {
                            if ("0000" === data.code) {
                                $scope.find();
                            } else {
                                alert(data.msg);
                            }
                        });
                    },"cancel":function(){
                        //用户取消，不做操作
                    }});
            }
        }

        //返回
        $scope.goback = function(){
            var menu = {"url":"modules/content/usermanagement/teacherCenter/list?father_id="+params.father_id};
            eventBusService.publish("modules.welcome.load",menu);
        }


}}});
